<#include "/resources/share/common/_commtop.html"/>
<@layout>
<head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/framework/summernote/summernote.css"></link>
<script type="text/javascript" src="${contextPath}/resources/framework/summernote/summernote.min.js"></script>
<script type="text/javascript" src="${contextPath}/resources/framework/summernote/lang/summernote-zh-CN.js"></script>
</head>
<form action="${contextPath}/sectiondetail/save" method="post" enctype="multipart/form-data">
		<div class="row clearfix">
			<div class="col-md-8 column">
				<#list sectionDetailPage.getList() as x>
					<div class="media well">
						<a href="${contextPath}/login/view/${x.getLong('user.id')}" class="pull-left">
						<#if x.getStr('user.headPortraitImg')==null>
							<img src="resources/web/image/userdefualt.png" 
							class="media-object imgheadcss"/>
						<#else>
							<img src="${x.getStr('user.headPortraitImg')}" 
							class="media-object imgheadcss"/>
						</#if>
						</a>
						<div class="media-body">
							<h4 class="media-heading">
							${x.getStr('user.nickName')}
							</h4> 
							这个人很懒，没有什么贡献！
							<div class="media">
								<a href="${contextPath}/sectiondetail/${x.getLong('section.id')}" class="pull-left">
									<img src="${x.getStr('section.sectionImg')}" 
									class="media-object imgcontextcss"/>
								</a>
								<div class="media-body">
									<h4 class="media-heading">
								${x.getStr("section.name")}
							</h4> ${x.getStr("section.context")}
								</div>
							</div>
						</div>
					</div>
				</#list>
			</div>
			</div>

		<#include "/resources/share/common/_paginate.html" />
		<@paginate currentPage=sectionDetailPage.pageNumber totalPage=sectionDetailPage.totalPage actionUrl="${contextPath}/" />
	</div>
<input type="hidden" name="context" id="SummernoteCode"/>
<div id="summernote"></div>
${contextMsg}
 <script>
    $(document).ready(function() {
        $('#summernote').summernote();
    });

    $('#summernote').summernote({
    	  lang: 'zh-CN',
    	  //height: 300,                 // set editor height
    	  minHeight: 300,             // set minimum height of editor
    	  maxHeight: null,             // set maximum height of editor
    	  focus: true                  // set focus to editable area after initializing summernote
    	});
    $('#summernote').summernote({  
        height: "500px",  
        callbacks: {  
            onImageUpload: function(files) { //the onImageUpload API  
                img = sendFile(files[0]);  
        }  
    }  
    });  

    function sendFile(file) {  
        data = new FormData();  
        data.append("file", file);  
        console.log(data);  
        $.ajax({  
            data: data,  
            type: "POST",  
            url: "{:U('Test/upload')}",  
            cache: false,  
            contentType: false,  
            processData: false,  
            success: function(url) {  
                  $("#summernote").summernote('insertImage', url, 'image name'); // the insertImage API  
            }  
        });  
    }  
	
	function getCode(){
		var markupStr = $('#summernote').summernote('code');
		document.getElementById("SummernoteCode").value = markupStr;
	}
	function setCode(markupStr){
		//var markupStr = 'hello world';
		$('#summernote').summernote('code', markupStr);
	}
	window.setInterval("getCode()", 200);
  </script>
  
  <div class="form-group">
  <label for="userNo" class="col-sm-2 control-label">验证码</label>
	<div class="col-sm-10">
		<img src="${contextPath}/common/captcha" />
	</div>
  </div>
  <div class="form-group">
		<div class="col-xs-12  ">
			<div class="input-group">
			<input type="text" id="captcha" name="captcha" 
				    class="form-control" 
			    	placeholder="验证码" style="width: 400px;"/>
			<label for="inputPassword" class="control-label" name="password">${codeMsg}</label>
			</div>
		</div>
    </div>
  
  <div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						 <button type="submit" class="btn btn-default">确认</button>
					</div>
  </div>
</form>
<#include "/resources/share/common/_friendshiplink.html" />
<@pagelink />
</@layout>
